
<template>
    <div id="myLineChart" :style="{width: '500px', height: '300px'}"></div>
</template>
<script>
// 引入 ECharts 主模块
var echarts = require("echarts/lib/echarts");
// 引入柱状图
require("echarts/lib/chart/bar");
// 引入提示框和标题组件
require("echarts/lib/component/tooltip");
require("echarts/lib/component/title");
export default {
  props: {
    data: {
      type: Object,
      default: {}
    }
  },
  methods: {
    drawGraph(id) {
      var myChart = echarts.init(document.getElementById(id));
      // 绘制图表
      myChart.setOption({
        title: {
          text: "折线图组件"
        },
        tooltip: {},
        xAxis: {
          data: this.data.xAxisData
        },
        yAxis: {},
        series: this.data.series
      });
    }
  },
  mounted() {
    this.drawGraph("myLineChart");
  }
};
</script>